package com.cz.mydao.config;

import com.cz.mydao.pool.CustomConnectionPool;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @descriptions: SQLServer连接池
 * @author: Joker.
 * @date: 2024/12/23 11:50
 * @version: 1.0
 */
@Component
public class SQLServerConnectionPool implements ConnectionPool{

    /**
     * 数据库连接驱动
     */
    @Value("${spring.datasource.sqlserver.driver-class-name}")
    private String driver;

    /**
     * url路径
     */
    @Value("${spring.datasource.sqlserver.url}")
    private String url;

    /**
     * 用户名
     */
    @Value("${spring.datasource.sqlserver.name}")
    private String name;

    /**
     * 密码
     */
    @Value("${spring.datasource.sqlserver.password}")
    private String password;


    /**
     * 获取连接池
     * @return 连接池
     */
    @Override
    public CustomConnectionPool createConnectionPool() {
        return new CustomConnectionPool(driver, url, name, password);
    }
}
